declare namespace util = "http://exist-db.org/xquery/util";
declare namespace validation = "http://exist-db.org/xquery/validation";

(: get file as base64 data from request object :)
let $upload := request:get-uploaded-file-data("upload")
        
(: convert base64 to string :)
let $text := util:binary-to-string($upload)

(: parse into node :)
let $parsed := util:parse($text)

(: validate (be sure to upload all schema-files to /db/ddi3/xsd/) :)
let $report := validation:jaxv-report($parsed , xs:anyURI('/db/ddi3/xsd/instance.xsd'))

return $report